package com.czxy.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

//明确这个类是配置类
@Configuration
//明确要扫描的controller包
@ComponentScan({"com.czxy.controller"})
@EnableWebMvc  // 支持字符串日期自动转换成Date日期 , 支持文件上传
public class SpringMVCConfig  {

    @Bean
    public InternalResourceViewResolver InternalResourceViewResolver() {
        // 创建视图解析器对象
        InternalResourceViewResolver resolver = new InternalResourceViewResolver();
        // 设置jsp所在文件夹
        resolver.setPrefix("/WEB-INF/jsp/");
        // 设置后缀名
        resolver.setSuffix(".jsp");
        return resolver;
    }


}
